package com.zsc.edu.testcustomizeui;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MyView mView = findViewById(R.id.my_view);
        mView.setToast("老师想下课，可是同学们都不想走");

        Toast toast = Toast.makeText(MainActivity.this, "肚子饿了吗，马上就下课了", Toast.LENGTH_LONG);
        MyView myView = new MyView(MainActivity.this, null);
        myView.setToast("肚子饿了吗，马上就下课了");
        toast.setView(myView);
        toast.show();

        myView.setToast("等一下哈，作业还没做完");
        toast.setView(myView);
        toast.show();

    }
}